<template>
	<view class="orderDetails">
		<TopHead :title="'服务'"></TopHead>
		<view class="conbox">

			<view class="info-box">

				<view class="goods-Info">
					<view class="itemBox">
						<view class="iten-cont">
							<image class="item-img" :src="path+taskData.info.productEntity.logo"></image>
							<view class="iten-cont-txt">
								<view class="title2">{{taskData.info.productEntity.name}}
								</view>
							</view>
						</view>
					</view>
					<view class="info-view">
						<view>
						<view v-for="(item,index) in taskData.info.specificationList">
							<view>{{item.specificationName}}</view>
							<view v-for="(item1,index1) in item.orderItemSpecificationValueList">{{item1.value}}</view>
						</view>
						</view>
						<!-- <view>
							<view>联系电话</view>
							<view>13037684965</view>
						</view> -->
					</view>
			<!-- 		<view class="info-view">
						<view>
							<view>医院</view>
							<view>大坪医院</view>
						</view>
						<view>
							<view>地址</view>
							<view>重庆市渝中区大坪。。。</view>
						</view>
					</view>
					<view class="info-view">
						<view>
							<view>备注</view>
							<view>病人行动不方便需要慢行</view>
						</view>

					</view> -->
					<view class="otherInfo otherInfo1">
						<text>到达时间：</text>
						<view class="sum-view">{{taskData.arrivalTime}}</view>
					</view>
		<view class="otherInfo">
			<text>开始服务：</text>
			<view class="sum-view">{{taskData.startTime}}</view>
		</view>
		<view class="otherInfo">
			<text>结束时间：</text>
			<view class="sum-view">{{taskData.endTime}}</view>
		</view>
				</view>

			</view>
			<view class="btnBox">
				<view class="btn1" @click="handleArrival"  v-show="taskData.status==9">到达</view>
				<view class="btn1" @click="handleBegin"  v-show="taskData.status==10">开始服务</view>
				<view class="btn1" @click="handleEnd"  v-show="taskData.status==11">结束服务</view>
			</view>
		</view>


	</view>
</template>

<script>
	import TopHead from '../../components/topHead/topHead.vue';
	 

	export default {
		components: {
			TopHead,

		},
		data() {
			return {
					path: this.$http.tpUrl + '/', // 图片前缀
				items: [{
						value: '0',
						name: '余额',
						checked: 'true'
					},
					{
						value: '1',
						name: '微信'
					},
				],
				current: 0,
				beizhu: '',
				numer: 1, // 数量
				userInfo: {},
				taskId: "",
				taskData: {}
			}
		},
	onLoad(options) {
	console.log('URL参数:', options);
	this.taskId = options.taskId;
	    console.log('taskId:', this.taskId);
			},
		onShow() {

			this.initData()
		},
		onReachBottom() {
			// 触底分页
			console.log('触底')
			// if (this.total > this.list.length) {
			// 	this.page = parseInt(this.page) + 1
			// }
		},
		methods: {
			handleArrival() {
				var parms = {
					id: this.taskData.id,
					status: 10
				}
				this.modify(parms);
			},
			handleBegin() {
				var parms = {
					id: this.taskData.id,
					status: 11
				}
				this.modify(parms);
			},
	 
			handleEnd() {
				var parms = {
					id: this.taskData.id,
					status: 3
				}
				this.modify(parms);
			},
			modify(parms) {
				let _this = this;
				var url = '/wechatApplet/worker/jobTask/' + parms.id + "/" + parms.status
				_this.$http.fetchData({
					url: url,
					method: 'PUT',
					data: parms,
					success(res) {
						if (res.code != 200) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
							return
						}
						_this.initData();

					}

				})
			},
			// 数据请求示例
			initData() {
				let _this = this;
				_this.$http.fetchData({
					url: '/wechatApplet/worker/jobTask/' + _this.taskId,
					method: 'GET',
					data: {},
					success(res) {
						if (res.code != 200) {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
							return
						}
						_this.taskData = res.data;

						console.log("taskData", _this.taskData);

					}

				})
			},
			// dianhua
			phoneCall(item) {
				uni.makePhoneCall({
					phoneNumber: '023-62433333' //仅为示例
				});
			},
			radioChange: function(evt) {
				for (let i = 0; i < this.items.length; i++) {
					if (this.items[i].value === evt.detail.value) {
						this.current = i;
						break;
					}
				}
			},
			// 弹窗
			open() {
				this.$refs.popup.open('center')
			},
			close() {
				this.$refs.popup.close()
			},
			// 减少
			reduce() {
				if (this.numer == 1) {
					uni.showToast({
						icon: 'none',
						title: '数量不能少于1',
						duration: 2000
					})
				} else {
					this.numer--
				}
				console.log(this.numer)
			},
			addNum() {
				this.numer++
				console.log(this.numer)
			},

		}
	}
</script>

<style scoped>
	.orderDetails {
		background: #f3f3f3;
		height: 100%;
		box-sizing: border-box;
		overflow-y: auto;
	}

	.headBox {
		font-size: 36rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Bold;
		font-weight: 700;
		text-align: center;
		color: #232323;
		padding-top: 88rpx;
		padding-left: 30rpx;
		padding-right: 30rpx;
		padding-bottom: 112rpx;
		background: linear-gradient(89deg, #f9d7a6 1%, #ffdc95 100%);
	}

	.headBox .wzText {
		line-height: 56rpx;
	}

	.conbox {
		padding: 30rpx;
		padding-top: 210rpx;
		padding-bottom: 160rpx;
	}

	.box1 {
		/* display: flex; */
	}

	.box1 .left-box1 {
		flex: 1;
	}

	.title1 {
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Bold;
		font-weight: 700;
		color: #5d4529;
	}

	.title1-text {
		font-size: 24rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #c2c2c2;
		margin-top: 16rpx;
	}

	.box1 .right-icon-box {
		width: 132rpx;
		height: 102rpx;
	}

	.box1 .right-icon-box>view {
		width: 102rpx;
		height: 102rpx;
		background: linear-gradient(180deg, #e47917, #feefe2);
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.info-box {
		/* background: #ffffff; */
		border-radius: 10rpx;
		/* box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(93, 69, 41, 0.25); */
		padding: 24rpx;
		/* margin-top: 30rpx; */
	}

	.title-dianpu {
		font-size: 28rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #5d4529;
		padding-bottom: 14rpx;
	}

	.confirmOrder-icon1 {
		width: 28rpx;
		height: 32rpx;
		display: inline-block;
		margin-right: 22rpx;
	}

	.goods-Info {
		/* padding: 40rpx 0; */
		/* padding-bottom: 0; */
		/* border-top: 2rpx dashed #c7c7c7; */
		/* border-bottom: 2rpx dashed #c7c7c7; */
	}

	.price-view {
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Bold;
		font-weight: 700;
		text-align: right;
		color: #5d4529;
		padding-top: 30rpx;
		padding-bottom: 10rpx;
	}

	.iten-cont {
		padding: 24rpx 0 32rpx 0;
		display: flex;
	}

	.iten-cont .item-img {
		flex-shrink: 0;
		width: 178rpx;
		height: 178rpx;
		border-radius: 10rpx;
		background-color: #e4e5e5;
	}

	.iten-cont-txt {
		padding-top: 30rpx;
		padding-left: 18rpx;
		flex: 1;
	}

	.title2 {
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Bold;
		font-weight: 700;
		color: #5d4529;
		position: relative;
		padding-right: 110rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.title2 .title2-pic {
		font-size: 24rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #f61111;
		line-height: 52rpx;
		position: absolute;
		right: 0;
		top: 50%;
		margin-top: -26rpx;
	}

	.title2 .title2-pic text {
		font-size: 40rpx;
	}

	.title3 {
		font-size: 24rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #fdab34;
		margin-top: 18rpx;
		position: relative;
	}

	.title3 text {
		display: inline-block;
		line-height: 40rpx;
		background: #fff0db;
		padding: 0 18rpx;
		margin-left: 10rpx;
		border-radius: 10rpx;
	}

	.title3 text:first-child {
		margin-left: 0;
	}

	.title3 .num {
		line-height: 32rpx;
		position: absolute;
		right: 0;
		top: 50%;
		margin-top: -16rpx;
		font-size: 24rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #c2c2c2;
		background: none;
		padding: 0;
		margin: 0;
	}

	.title4 {
		font-size: 24rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #c2c2c2;
		margin-top: 12rpx;

	}

	.info-view {
		display: flex;
		margin-bottom: 40rpx;
	}

	.info-view>view {
		flex: 1;
	}

	.info-view>view>view>view:nth-child(1) {
		font-size: 28rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #7e8898;
	}

	.info-view>view>view:nth-child(2) {
		font-size: 28rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #5d4529;
		margin-top: 20rpx;
	}

	.otherInfo {
		font-size: 28rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #c2c2c2;
		margin-bottom: 24rpx;
		display: flex;
	}

	.otherInfo1 {
		margin-top: 65rpx;
	}

	.goods-Info .otherInfo:last-child {
		margin-bottom: 0;
	}

	.otherInfo text {
		color: #7e8898;
		flex-shrink: 0;
	}

	.sum-view {
		flex: 1;
		text-align: left;
		color: #5d4529;
	}

	.uni-list-cell {
		margin-left: 80rpx;
	}

	.yhq {
		color: #e47917;
	}

	.sum-view .add1 {
		width: 34rpx;
		height: 34rpx;
		box-sizing: border-box;
		display: inline-block;
		background: #ffffff;
		border: 2rpx solid #e47917;
		border-radius: 50%;
		font-size: 22rpx;
		font-weight: 400;
		color: #000000;
		text-align: center;
	}

	.sum-view .add2 {
		background: #e47917;
		border: 2rpx solid #e47917;
		color: #fff;
	}

	.sum-view .add {
		display: inline-block;
		width: 50rpx;
		text-align: center;
		vertical-align: middle;
		color: #000;
	}

	.sum-view .active {
		color: #e47917;
	}

	.sum-view .radioText {
		color: #000;
	}

	.uni-input {
		flex: 1;
		text-align: right;
		color: #000;
	}

	.price {
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Bold;
		font-weight: 700;
		color: #5d4529;
		text-align: right;
		padding-top: 30rpx;
		padding-bottom: 36rpx;
	}

	.btnBox {
		padding: 0 80rpx;
		margin-top: 0rpx;
	}

	.btnBox .btn1 {
		background: #e47917;
		border-radius: 10rpx;
		text-align: center;
		line-height: 112rpx;
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		color: #ffffff;
	}

	.btnBox .btn2 {
		font-size: 32rpx;
		font-family: Microsoft YaHei, Microsoft YaHei-Regular;
		font-weight: 400;
		text-align: center;
		color: #e47917;
		line-height: 112rpx;
		margin-top: 30rpx;
	}
</style>